#include<stdio.h>
#include<sys/uio.h>
#define BUF_SIZE 100
//readv接收多个输入缓冲数据
int main(int argc,char *argv[])
{
	struct iovec vec[2];
	char buf1[BUF_SIZE]={0,};
	char buf2[BUF_SIZE]={0,};
	int str_len;
	//vec[0]中注册的缓冲中保存5个字节
	//剩余数据将保存到vec[1]中注册的缓冲
	vec[0].iov_base=buf1;
	vec[0].iov_len=5;
	vec[1].iov_base=buf2;
	vec[1].iov_len=BUF_SIZE;
	
	str_len=readv(0,vec,2);
	printf("Read bytes:%d\n",str_len);
	printf("First message:%s\n",buf1);
	printf("Second message:%s\n",buf2);
	return 0;
}
